package Chapter10_InnerClass;

/**
 * Date: 2019/2/19
 * Time: 11:21
 * User: Driss.
 *
 * 10.5 在方法和作用域中内的内部类
 */
public class Parcel5 {
    public Destination destination(String s){

        //在方法中定义内部类
        class PDestination implements Destination{
            private String label;
            private PDestination(String whereTo){
                label = whereTo;
            }
            public String readLabel(){return label;}
        }

        return new PDestination(s);
    }

    public static void main(String[] args) {
        Parcel5 p = new Parcel5();
        Destination d = p.destination("Tasmania");
    }
}
